package com.timber.util;


import java.util.Vector;


public class SearchableComboTableModelWithEntity extends SLTableModel
{
  static Vector v = new Vector();

  static
  {

    cm = new SearchableComboColumnManager();

    v.add( cm.getByIdClone( SearchableComboColumnManager.ENTITY ) );
    v.add( cm.getByIdClone( SearchableComboColumnManager.CODE ) );
    v.add( cm.getByIdClone( SearchableComboColumnManager.DESCR ) );
  }

  public SearchableComboTableModelWithEntity( int rows )
  {
    super( rows, v );
    setAutoColumnClass( 1 );
  }

   public SearchableComboTableModelWithEntity( Vector dataVector )
  {
    super( dataVector, v );
    setAutoColumnClass( 1 );
  }


  public Object getFieldAt( Object o, int c )
  {
    Object ret = null;

    if( o != null )
    {
      int id = getColumnId( c );
      SLDataObjectWithEntity item = ( SLDataObjectWithEntity )o;

      switch( id )
      {
        case SearchableComboColumnManager.CODE:
	  ret = item.listString();
	  break;

	case  SearchableComboColumnManager.DESCR:
	  ret = item.getDescr();
	  break;

        case SearchableComboColumnManager.ENTITY:
	  ret = item.getEntity();
	  break;
	}
    }

    return ret;
  }
}
